package container;

import java.io.File;

public class Context extends Container{
    private String path;
    private String docBase;

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getDocBase() {
        return docBase;
    }

    public void setDocBase(String docBase) {
        this.docBase = docBase;
    }

    public String getClassPathRoot(String appBase){
        if (!appBase.endsWith(File.separatorChar + "")){
            appBase = appBase + File.separatorChar;
        }
        String docBase =this.getDocBase();
        if (docBase.startsWith("/")){
            docBase = docBase.substring(1);
        }
        if (docBase.endsWith("/")){
            docBase = docBase.substring(0,path.length() - 1);
        }
        return appBase + docBase;
    }

}
